import { director, Node } from "cc";
export class BaseClass {
    private _rootNode:Node = null;
    useWebSocket: any;
    public get rootNode(){
        return this._rootNode;
    }

    constructor() {
        this._rootNode = director.getScene().getChildByName('__rootNode__');
        if (!this._rootNode) {
            this._rootNode = new Node();
            this._rootNode.name = '__rootNode__';
            director.getScene().addChild(this._rootNode); 
        }
      
        //@zh 标记为常驻节点，这样场景切换的时候就不会被销毁了
        director.addPersistRootNode(this._rootNode);
    }
}